﻿using Newtonsoft.Json;
using SharpDX;
using System.Collections.Generic;
using System.Windows.Media.Media3D;
using X.WPF.Controls.Visual3Ds;
using Color = System.Drawing.Color;

namespace X.WPF.Controls.Models
{
    /// <summary>
    /// 标记信息
    /// </summary>
    public class Marker3DMarker
    {
        #region # 构造器
        /// <summary>
        /// 创建标记信息构造器
        /// </summary>
        public Marker3DMarker(string name, Point3D originLocation, Point3D markerLocation, List<Vector3> points, object tag = null)
        {
            this.Name = name;
            this.OriginLocation = originLocation;
            this.MarkerLocation = markerLocation;
            this.Tag = tag;

            this.Table = new Marker3DTable
            {
                Visual3DSpace = 5,
            };
            this.Label = new Marker3DLabel();
            this.Feature = new Marker3DFeature(points);

            // 默认值
            this.Pass = "--";
            this.PassColor = Color.Black;
            this.PassBackgroundColor = Color.LightGray;
        }

        /// <summary>
        /// 创建标记信息构造器
        /// </summary>
        public Marker3DMarker(string name, Point3D originLocation, Point3D markerLocation, List<Vector3> points, string pass, Color passColor, Color passBackgroundColor, object tag = null)
            : this(name, originLocation, markerLocation, points, tag)
        {
            this.Pass = pass;
            this.PassColor = passColor;
            this.PassBackgroundColor = passBackgroundColor;
        }
        #endregion

        #region # 属性

        #region 名称 —— string Name
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }
        #endregion

        #region 是否合格 —— string State
        /// <summary>
        /// 是否合格
        /// </summary>
        public string Pass { get; set; }
        #endregion

        #region 是否合格颜色 —— Color PassColor
        /// <summary>
        /// 是否合格颜色
        /// </summary>
        public Color PassColor { get; set; }
        #endregion

        #region 是否合格背景颜色 —— Color PassBackgroundColor
        /// <summary>
        /// 是否合格背景颜色
        /// </summary>
        public Color PassBackgroundColor { get; set; }
        #endregion

        #region 原始位置 —— Point3D OriginLocation
        /// <summary>
        /// 原始位置
        /// </summary>
        public Point3D OriginLocation { get; set; }
        #endregion

        #region 标记位置 —— Point3D MarkerLocation
        /// <summary>
        /// 标记位置
        /// </summary>
        public Point3D MarkerLocation { get; set; }
        #endregion

        #region 连线 3D建模 —— LinesVisual3D LineVisual3D
        /// <summary>
        /// 连线 3D建模
        /// </summary>
        [JsonIgnore]
        public LinesVisual3D LineVisual3D { get; set; }
        #endregion

        #region 标签 —— OrientThreeDLabelCm Label
        /// <summary>
        /// 标签
        /// </summary>
        [JsonIgnore]
        public Marker3DLabel Label { get; set; }
        #endregion

        #region 是否显示标签 —— bool IsShowLabel
        /// <summary>
        /// 是否显示标签
        /// </summary>
        [JsonIgnore]
        public bool IsShowLabel { get; private set; }
        #endregion

        #region 表格 —— OrientThreeDTableCm Table
        /// <summary>
        /// 表格
        /// </summary>
        public Marker3DTable Table { get; set; }
        #endregion

        #region 是否显示表格 —— bool IsShowTable
        /// <summary>
        /// 是否显示标签
        /// </summary>
        [JsonIgnore]
        public bool IsShowTable { get; private set; }
        #endregion

        #region 特征 —— OrientThreeDFeatureCm Feature
        /// <summary>
        /// 特征
        /// </summary>
        public Marker3DFeature Feature { get; set; }
        #endregion

        #region 标签 —— object Tag
        /// <summary>
        /// 标签
        /// </summary>
        public object Tag { get; set; }
        #endregion

        #endregion

        #region # 方法

        #region # 显示标签 —— void ShowLabel()
        /// <summary>
        /// 显示标签
        /// </summary>
        public void ShowLabel()
        {
            this.IsShowLabel = true;
            this.IsShowTable = false;
        }
        #endregion

        #region # 显示表格 —— void ShowTable()
        /// <summary>
        /// 显示表格
        /// </summary>
        public void ShowTable()
        {
            this.IsShowLabel = false;
            this.IsShowTable = true;
        }
        #endregion

        #endregion

    }
}